package com.zhu.controller;

import com.zhu.pojo.Inventory;
import com.zhu.pojo.Material;
import com.zhu.pojo.Person;
import com.zhu.service.InventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/inventory")
public class InventoryController {
    @Autowired
    private InventoryService inventoryService;
    @PostMapping("/materials")
    public List<Inventory> materialList(){
        return inventoryService.materialList();
    }
    @PostMapping("/storage")
    public void storage(@RequestBody Material material){


    }

    @PostMapping("/storageAdd")
    public void storageAdd(@RequestBody List<Integer> list){
        inventoryService.storageAdd(list);
    }

    @PostMapping("/persons")
    public List<Person> personList(){
        return inventoryService.personList();
    }

    @PostMapping("/dispatch")
    public void dispatch(@RequestBody Map<String,Object> map){

         inventoryService.dispatch(map);

    }

    @PostMapping("/query")
    public List<Material> query(@RequestBody Map<String,Object> map){
        return inventoryService.query(map);
    }
}
